<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>

<script src="${ctx}/js/controllers/property/repairinfo/RepairInfoListController.js"
	type="text/javascript"></script>
<script type="text/javascript">
		var ctx = '${ctx}';
		setCtx(ctx);
</script>
<section>
	<div style="height: 40px; line-height: 40px;">
		<div class="forword_area"></div>
		<div class="location">
			当前位置：${sessionScope.currcent_position}</div>
	</div>
	<hr>
	<section class="panel panel-default">
		<!--begin 搜索栏 -->
		<div>
			<div>
				<div >
					<input id="title" type="text" maxlength="20" value="${(not empty title)? title : ''  }" class="input-sm form-control" placeholder="标题">
	            	<input type="hidden" id="infoType" value = "-1"/>
	                <%-- <div class="btn-group">
			             <select id="infoType" name="infoType" class="dropdown-menu">
							<option value="-1">报修类型</option>
							<c:forEach items="${repairInfoType }" var="rtype">
								<option value="${rtype.value }" <c:if test="${infoType == rtype.value }">selected</c:if>>${rtype.label }</option>
							</c:forEach>
						 </select>
	            	</div> --%>
	             
	            	<div class="btn-group">
			             <select id="level" name="level" class="dropdown-menu">
							<option value="-1">危害程度</option>
							<c:forEach items="${harmLevel }" var="rlevel">
								<option value="${rlevel.value }" <c:if test="${level == rlevel.value }">selected</c:if>>${rlevel.label }</option>
							</c:forEach>
						 </select>
	            	</div>
	            	<div class="btn-group">
			             <select id="state" name="state" class="dropdown-menu">
							<option value="-1">报修状态</option>
							<c:forEach items="${repairInfoState }" var="rstate">
								<option value="${rstate.value }" <c:if test="${state == rstate.value }">selected</c:if>>${rstate.label }</option>
							</c:forEach>
						 </select>
	            	</div>
	            	&nbsp;
	            	<div style="float:left;height: 28px;margin-left: 10px;"> 
	                    <input id="beginDate" type="text" maxlength="6" class="input-sm" onClick="WdatePicker({maxDate:'2099-12-31 23:59:59'})" 
	                    value="${beginDate}" placeholder="起始时间" style="float:left;width:100px;">&nbsp;&nbsp;
	                  	<input id="endDate" type="text" maxlength="20"  class="input-sm" onClick="WdatePicker({maxDate:'2099-12-31 23:59:59'})"
	                  	value="${endDate}" placeholder="结束时间" style="float:left;width:100px;margin-left: 10px;">
	                </div>
	                &nbsp;
	            	<div class="btn-group" style="margin-left: 0px;">
						<select class="dropdown-menu" id="pSize" >
							<c:forEach items="${pageSizes }" var="item">
								<option value="${item.value }"
									<c:if test="${pSize == item.value }">selected</c:if>>&nbsp;&nbsp;&nbsp;${item.label }</option>
							</c:forEach>
						</select>
					</div>
					<div class="form-control">
						<div class="search" onclick="getRepairInfoList();">
							<img src="${ctx }/images/table/search_second.png">
						</div>
						<div style="width:45px;height:25px;margin-left:10px;padding-top:3px;padding-left:10px;background-color:#37ced4;
							color:white;cursor: pointer;float:left;" onclick="exportExcel();">导出</div>
					</div>
				</div>
			</div>
		</div>
		<!--end 搜索栏 -->

		<!--begin table表格 -->
		<div>
			<table class="table">
				<thead>
					<tr>
						
						<th width="5%">序号</th>
						<th width="20%">标题</th>
						<th width="10%">报修类型</th>
						<th width="10%">危害程度</th>
						<th width="10%">状态</th>
						<th width="20%">操作</th>
					</tr>
				</thead>
				<tbody id="tableTbody">
					<c:forEach items="${repairInfo.list }" var="repairInfo"
						varStatus="repairInfoStatus">
						<tr onmouseover="mouseoverOne(this)" onmouseout="mouseoutOne(this)">
							<td>${repairInfoStatus.index + 1 }</td>
							<td>${repairInfo.title}</td>
							<td>
		                        <c:forEach items="${repairInfoType }" var="infoType">
		                       		<c:if test="${infoType.value == repairInfo.type}">
		                       			${infoType.label}
		                       		</c:if>
		                        </c:forEach>
	                        </td>
	                        <td>
		                        <c:forEach items="${harmLevel }" var="infoLevel">
		                       		<c:if test="${infoLevel.value == repairInfo.level}">
		                       			${infoLevel.label}
		                       		</c:if>
		                        </c:forEach>
	                        </td>
	                        <td>
		                        <c:forEach items="${repairInfoState }" var="infoState">
		                       		<c:if test="${infoState.value == repairInfo.state}">
		                       			${infoState.label}
		                       		</c:if>
		                        </c:forEach>
	                        </td>
							<td >
	                          <a class="fa fa-check " onclick="changeState('${repairInfo.id}','${repairInfo.state}');">
	                          	<c:if test="${repairInfo.state == 0}">[通过</c:if>&nbsp;&nbsp;
	                          	<c:if test="${repairInfo.state == 1}">开始维修</c:if>
	                          	<c:if test="${repairInfo.state == 2}">维修完成</c:if>
	                          	<c:if test="${repairInfo.state == 0}">不通过]</c:if>
	                          </a>
	                          <c:if test="${repairInfo.cost == null}"><a class="fa fa-check " onclick="addMemo('${repairInfo.id}');">[添加备注]</a></c:if>
	                          <a class="fa fa-check " onclick="addReply('${repairInfo.id}');">回复&nbsp;&nbsp;|&nbsp;</a>
	                          <a class="fa fa-check " onclick="Lookreview('${repairInfo.id}');">查看</a>
	                        </td>
							
						</tr>
					</c:forEach>
				</tbody>

				<tfoot>
					<tr>
						<td colspan="6">
							<div>
								<div style="float: left;">
									<span class="total">合计 ${repairInfo.total} 条数据</span>
									<input type="hidden" value="${repairInfo.total}" id="total">
								</div>
								<div
									style="float: right; margin-right: 10px; margin-top: 29px">
									<div style="float: left;">
										<ul class="footer_ul">
											<c:if test="${repairInfo.hasPreviousPage }">
												<li onclick="gotoPage(${currentPage-1 });"><a
													style="color: #37CED4">&lt;&lt;</a></li>
											</c:if>
											<c:if test="${repairInfo.firstPage > 1}">
												<li onclick="gotoPage(1);"
													style="border: 1px solid #9A9A9A;"><a>1</a></li>
												<c:if test="${repairInfo.firstPage > 2}">
				                        		...
				                        	</c:if>
											</c:if>
											<c:forEach items="${repairInfo.navigatepageNums }" var="page">
												<li onclick="gotoPage(${page });"
													class="<c:if test="${currentPage == page }">active</c:if>"
													style="border: 1px solid #9A9A9A;"><a>${page}</a></li>
											</c:forEach>
											<c:if test="${repairInfo.lastPage < repairInfo.pages}">
												<c:if test="${repairInfo.firstPage < repairInfo.pages - 1}">
				                        		...
				                        	</c:if>
												<li onclick="gotoPage(${repairInfo.pages});"
													style="border: 1px solid #9A9A9A;"><a>${repairInfo.pages}</a>
												</li>
											</c:if>
											<c:if test="${repairInfo.hasNextPage }">
												<li><a onclick="gotoPage(${currentPage+1});"
													style="color: #37CED4">&gt;&gt;</a></li>
											</c:if>
										</ul>
									</div>
									<div style="float: left; height: 30px;">
										<span>跳转到</span> <input class="inputclass" id="pageNo"
											onkeydown="if(event.keyCode==13){event.keyCode=0;return false;}"
											type="text" value="${currentPage }"
											style="width: 30px; height: 31px"onkeyup = "checInputNum(this)"> <span>页</span> <span
											class="buttonclass" id="J_JumpTo"
											onclick="gotoRepairInfoPage(null);"><a>GO</a></span>
									</div>
								</div>
							</div>
						</td>
					</tr>
				</tfoot>
			</table>

		</div>
		<%@include file="/views/common/footer.jsp"%>
	</section>
</section>
		
<script type="text/javascript">
//实现选中取消切换图片
$("tbody td>img").toggle(function(){    
    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
    //$(this).parents("tr").children().each(function(){
	   // $(this).css("background","#D3F0F1");
   //});    
},function(){    
    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
    //$(this).parents("tr").children().each(function(){
	    //$(this).css("background","");
   //});
    });
    
//实现全选切换所有选项图标
$("#all").toggle(function(){    
    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
    $("tbody td>img").attr("src","${ctx }/images/tables/honggou.png");  
},function(){    
    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
    $("tbody td>img").attr("src","${ctx }/images/tables/wugou.png");  
    });
    
</script>
<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
